<template>
    <div class="mask-wrapper-img" v-if="bigImgShow">
        <div class="mask" @click="bigImgHide"></div>
        <div class="wrapper">
            <div class="img-block" style="height: 100%">
                <el-carousel trigger="click" height="100%" ref="carousel" :initial-index="selectIndex" :autoplay="false">
                    <el-carousel-item v-for="(v, i) in bigImgData" :key="i">
                        <img v-if="!v.accessUrl" :src="v" alt="" />
                        <img v-if="v.accessUrl" :src="v.accessUrl" alt="" />
                    </el-carousel-item>
                </el-carousel>
            </div>
        </div>
    </div>
</template>

<script setup>
import { defineProps, defineEmits } from 'vue'

const props = defineProps({
    bigImgData: { type: Array, default: () => [] },
    bigImgShow: { type: Boolean, default: false },
    selectIndex: { type: Number, default: 0 }
})

const emit = defineEmits(['detailImgList', 'bigImgHide'])

function bigImg(v, i) {
    emit('detailImgList', v, i)
}
function bigImgHide() {
    emit('changeBigImgShow')
}
</script>

<style lang="scss" scoped>
.el-carousel {
    height: 100%;
}
.el-carousel__container {
    height: 100%;
}
.el-carousel__item {
    height: 100%;
}
.el-carousel__item img {
    padding: 10px;
    box-sizing: border-box;
    max-width: 100%;
    max-height: 100%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.el-carousel__arrow {
    font-size: 20px;
    font-weight: 700;
}
.mask-wrapper-img .mask {
    position: fixed;
    bottom: 0;
    right: 0;
    top: 0;
    left: 0;
    background: #000;
    z-index: 999999;
    opacity: 0.3;
    filter: alpha(opacity=30);
}
.mask-wrapper-img .wrapper {
    position: fixed;
    top: 15%;
    left: 20%;
    width: 60%;
    height: 70%;
    /* margin-top: -148px; */
    /* margin-left: -223px; */
    background: #fff;
    z-index: 9999999;
}
</style>
